//
//  LTView.m
//  MY Project For Sport
//
//  Created by dllo on 16/1/28.
//  Copyright © 2016年 dilo. All rights reserved.
//

#import "LTView.h"

#import <DKNightVersion.h>

#define WIDTH self.frame.size.width
#define HEIGHT self.frame.size.height

#define WEIGHTT [UIScreen mainScreen].bounds.size.width / 375
#define HEIGHTT [UIScreen mainScreen].bounds.size.height / 667


@interface LTView ()

@property (nonatomic, retain) UIVisualEffectView *visualEffectView;

@end




@implementation LTView

- (void)dealloc {
    
    [_visualEffectView release];
    [_myView release];
    [_team1Image release];
    [_team2Image release];
    [_team1 release];
    [_team2 release];
    [_team1Score release];
    [_team2Score release];
    [_dress1 release];
    [_dress2 release];
    [_typeOfEnd release];
    [_type1Score release];
    [_type2Score release];
    [_matchName release];
    [_roundNumber release];
    [_bigSign release];
    [_smallSign release];
    [_matchOfTitle release];
    [_team1Number release];
    [_team2Number release];
    [_SliderOfLike release];
    [_team1Like release];
    [_team2Like release];
    
    
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame {
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        [self createSubview];
        
    }
    
    return self;
}



- (void)createSubview {
    
    
    self.myView = [[UIImageView alloc] initWithFrame:self.frame];
    [self addSubview:self.myView];
    [_myView release];
    
    self.visualEffectView = [[UIVisualEffectView alloc] initWithFrame:self.frame];
    [self addSubview:self.visualEffectView];
    [_visualEffectView release];
    
    UIBlurEffect *blur = [UIBlurEffect effectWithStyle:1];
    self.visualEffectView.effect = blur;
    
    
    
    self.SliderOfLike = [[UISlider alloc] initWithFrame:CGRectMake(WIDTH / 12 + WIDTH / 7 + WIDTH / 30 , HEIGHT / 9 + WIDTH / 7 + WIDTH / 30 + WIDTH / 14 + WIDTH / 30 + WIDTH / 60, WIDTH - WIDTH / 12 - WIDTH / 8 + WIDTH / 30 - (WIDTH / 12 + WIDTH / 7 + WIDTH / 30 + WIDTH / 15), WIDTH / 60)];
    [self addSubview:self.SliderOfLike];
    [_SliderOfLike release];
    self.SliderOfLike.thumbTintColor = [UIColor clearColor];

    
    self.team1Number = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH / 12 + WIDTH / 30 + WIDTH / 7 - WIDTH / 15, HEIGHT / 9 + WIDTH / 7 + WIDTH / 30 + WIDTH / 14 + WIDTH / 30 + WIDTH / 30 , WIDTH / 6, WIDTH / 15)];
    [self addSubview:self.team1Number];
    [_team1Number release];
    self.team1Number.font = [UIFont systemFontOfSize:15];
    self.team1Number.textColor = [UIColor whiteColor];

    
    
    self.team2Number = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH - WIDTH / 12 - WIDTH / 8 - WIDTH / 8 - WIDTH / 30 + WIDTH / 15, HEIGHT / 9 + WIDTH / 7 + WIDTH / 30 + WIDTH / 14 + WIDTH / 30 + WIDTH / 30, WIDTH / 6, WIDTH / 15)];
    [self addSubview:self.team2Number];
    [_team2Number release];
    self.team2Number.font = [UIFont systemFontOfSize:15];
    self.team2Number.textColor = [UIColor whiteColor];
    
    self.typeOfEnd = [[UILabel alloc] initWithFrame:CGRectMake(self.center.x - WIDTH / 11, HEIGHT / 9, WIDTH / 20, HEIGHT / 20)];
    [self addSubview:self.typeOfEnd];
    [_typeOfEnd release];
    //self.typeOfEnd.backgroundColor = [UIColor redColor];
    //self.typeOfEnd.text = @"点球";
    self.typeOfEnd.textColor = [UIColor whiteColor];
    self.typeOfEnd.font = [UIFont systemFontOfSize:9];
    
    self.type1Score = [[UILabel alloc] initWithFrame:CGRectMake(self.center.x - WIDTH / 11 + WIDTH / 20 + WIDTH / 60, HEIGHT / 9, WIDTH / 20, HEIGHT / 20)];
    [self addSubview:self.type1Score];
    [_type1Score release];
    self.type1Score.textColor = [UIColor whiteColor];
    //self.type1Score.text = @"109";
    self.type1Score.font = [UIFont systemFontOfSize:6];
    // self.type1Score.backgroundColor = [UIColor redColor];
    
    
    self.type2Score = [[UILabel alloc] initWithFrame:CGRectMake(self.center.x - WIDTH / 11 + WIDTH / 20 + WIDTH / 30 + WIDTH / 25 + WIDTH / 40 + WIDTH / 60, HEIGHT / 9 , WIDTH / 20, HEIGHT / 20)];
    [self addSubview:self.type2Score];
    [_type2Score release];
    //self.type2Score.text = @"999";
    self.type2Score.textColor = [UIColor whiteColor];
    self.type2Score.font = [UIFont systemFontOfSize:6];
    //self.type2Score.backgroundColor = [UIColor redColor];
    
    
    self.team1Score = [[UILabel alloc] initWithFrame:CGRectMake(self.center.x - WIDTH / 7, HEIGHT / 9 + HEIGHT / 13, HEIGHT / 9, HEIGHT / 13)];
    [self addSubview:self.team1Score];
    [_team1Score release];
    self.team1Score.textAlignment = NSTextAlignmentCenter;
    self.team1Score.textColor = [UIColor whiteColor];
    //self.team1Score.backgroundColor = [UIColor yellowColor];
    
    
    self.bigSign = [[UILabel alloc] initWithFrame:CGRectMake(self.center.x - WIDTH / 7 + WIDTH / 20 + HEIGHT / 13, HEIGHT / 9 + HEIGHT / 13, HEIGHT / 17, HEIGHT / 13)];
    [self addSubview:self.bigSign];
    [_bigSign release];
    
    //self.bigSign.backgroundColor = [UIColor yellowColor];
    self.bigSign.text = @":";
    self.bigSign.textColor = [UIColor whiteColor];
    self.bigSign.textAlignment = NSTextAlignmentCenter;
    
    self.team2Score = [[UILabel alloc] initWithFrame:CGRectMake(self.center.x - WIDTH / 7 + WIDTH / 20 + HEIGHT / 13 + HEIGHT / 17 + WIDTH / 20, HEIGHT / 9 + HEIGHT / 13, HEIGHT / 9, HEIGHT / 13)];
    [self addSubview:self.team2Score];
    [_team2Score release];
    self.team2Score.textAlignment = NSTextAlignmentCenter;
    self.team2Score.textColor = [UIColor whiteColor];
    // self.team2Score.text = @"aaaaaaaaa";
    
    self.matchOfTitle = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH / 10, 0, WIDTH / 5 * 4, 30 * HEIGHTT)];
    [self addSubview:self.matchOfTitle];
    // self.matchOfTitle.backgroundColor = [UIColor redColor];
    self.matchOfTitle.textAlignment = NSTextAlignmentCenter;
    [_matchOfTitle release];
    //   NSLog(@"%@", [self.matchOfTitle superview]);
    
    self.team1Image = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH / 12, HEIGHT / 9 , WIDTH / 6, WIDTH / 6)];
    [self addSubview:self.team1Image];
    //self.team1Image.backgroundColor = [UIColor orangeColor];
    [_team1Image release];
    self.team1Image.layer.cornerRadius = WIDTH / 12;
    self.team1Image.layer.masksToBounds = YES;
    
    self.team1 = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH / 12, HEIGHT / 9 + WIDTH / 7 + WIDTH / 30, WIDTH / 5, WIDTH / 14)];
    [self addSubview:self.team1];
    [_team1 release];
    self.team1.font = [UIFont systemFontOfSize:12];
    self.team1.textColor = [UIColor whiteColor];
    self.team1.textAlignment =  NSTextAlignmentCenter;
    // self.team1.backgroundColor = [UIColor cyanColor];
    
    self.team1Like = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH / 12, HEIGHT / 9 + WIDTH / 7 + WIDTH / 30 + WIDTH / 14, WIDTH / 8, WIDTH / 8)];
    [self addSubview:self.team1Like];
    [_team1Like release];
    self.team1Like.layer.cornerRadius = WIDTH / 16;
    self.team1Like.layer.masksToBounds = YES;
    self.team1Like.image = [UIImage imageNamed:@"zuozan-2"];
    //self.team1Like.backgroundColor = [UIColor redColor];

    self.team2 = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH - WIDTH / 12 - WIDTH / 8 - WIDTH / 20, HEIGHT / 9 + WIDTH / 7 + WIDTH / 30,  WIDTH / 5, WIDTH / 14)];
    // self.team2.backgroundColor = [UIColor cyanColor];
    [self addSubview:self.team2];
    [_team2 release];
    self.team2.textColor = [UIColor whiteColor];
    self.team2.textAlignment =  NSTextAlignmentCenter;
    self.team2.font = [UIFont systemFontOfSize:12];
    
    
    self.team2Like = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH - WIDTH / 12 - WIDTH / 8, HEIGHT / 9 + WIDTH / 7 + WIDTH / 30 + WIDTH / 14 , WIDTH / 8 , WIDTH / 8)];
    [self addSubview:self.team2Like];
    [_team2Like release];
    
    self.team2Like.layer.cornerRadius = WIDTH / 16;
    self.team2Like.layer.masksToBounds = YES;
    self.team2Like.image = [UIImage imageNamed:@"youzan3"];
    //self.team2Like.backgroundColor = [UIColor whiteColor];

    self.team2Image = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH - WIDTH / 12 - WIDTH / 8, HEIGHT / 9, WIDTH / 6 , WIDTH / 6)];
    [self addSubview:self.team2Image];
    [_team2Image release];
    self.team2Image.layer.cornerRadius = WIDTH / 12;
    self.team2Image.layer.masksToBounds = YES;

    
    
    if (HEIGHT == 192) {
        
        self.dress1 = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH / 12, HEIGHT / 9 + WIDTH / 7 + WIDTH / 30 + WIDTH / 14 + WIDTH / 30 + WIDTH / 15 + WIDTH / 30, WIDTH / 4, HEIGHT / 4)];
        //self.dress1.backgroundColor = [UIColor clearColor];
        [self addSubview:self.dress1];
        [_dress1 release];
    
        
        self.dress2 = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH - WIDTH / 12 - WIDTH / 4, HEIGHT / 9  + WIDTH / 7 + WIDTH / 30 + WIDTH / 14 + WIDTH / 30 + WIDTH / 15 + WIDTH / 30 , WIDTH / 4, HEIGHT / 4)];
        [self addSubview:self.dress2];
        [_dress2 release];
        
     } else {
    
      
    self.dress1 = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH / 12, HEIGHT / 9 + WIDTH / 7 + WIDTH / 30 + WIDTH / 14 + WIDTH / 30 + WIDTH / 15 + WIDTH / 30, WIDTH / 4, HEIGHT / 3)];
    //self.dress1.backgroundColor = [UIColor clearColor];
    [self addSubview:self.dress1];
    [_dress1 release];
    
    
    
    self.dress2 = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH - WIDTH / 12 - WIDTH / 4, HEIGHT / 9  + WIDTH / 7 + WIDTH / 30 + WIDTH / 14 + WIDTH / 30 + WIDTH / 15 + WIDTH / 30 , WIDTH / 4, HEIGHT / 3)];
    [self addSubview:self.dress2];
    [_dress2 release];
      
    }
    
    
}







/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

@end
